<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<fmt:bundle
	basename="br.com.universidade.castelo.branco.resources.ApplicationResources"
	prefix="">
<head>

	<link rel="stylesheet" type="text/css" href="resources/js/jquery/apprise.css" />
	<script src="resources/js/jquery/jquery-1.4.4.min.js"></script>
	<script src="resources/js/jquery/apprise-1.5.full.js"></script>
	
	<link rel="stylesheet" href="resources/js/jquery/jquery-ui.css" />
	<script src="resources/js/jquery/jquery-1.9.1.js"></script> 
	<script src="resources/js/jquery/jquery-ui.js"></script>
	
<script type="text/javascript">

function chamaExcluirModeloResposta(id_modelo_resposta){
$(function() {
    $( "#dialog-confirmaExclusao" ).dialog({
      resizable: false,
      height:140,
      modal: true,
      buttons: {
        "OK": function() {
        	$( this ).dialog( "close" );
        	excluirModeloResposta(id_modelo_resposta);
        },
        "Cancelar": function() {
          $( this ).dialog( "close" );
        }
      }
    });
  });
}  
  
function excluirModeloResposta(id_modelo_resposta){
		$.ajax({	
	        type: 'POST',  
	        url: 'excluiModeloResposta?id_modelo_resposta=' + id_modelo_resposta,  
	        success: function() {
	        	modeloRespostaExcluida();
	        }
	    });
}

function modeloRespostaExcluida(){
	window.location.href='modeloRespostaExcluida';
}
</script>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="resources/css/formatos.css" />
</head>
	<body>
		<jsp:include page="/WEB-INF/views/pesquisadesatisfacao/menu.jsp"
			flush="true"></jsp:include>

		<img src="resources/imagens/pixel_transparente.gif" height="5%"
			width="10%">
			
		<div align="center">

		<fieldset id="fieldsetConsulta">

			<legend id="alinhamentoFormConsulta">
				<h3>
					<fmt:message key="consulta.modulo.modelo.resposta.titulo"></fmt:message>
				</h3>
			</legend>
			
			<br />
			
			<c:forEach items="${modelosDeRespostas}" var="modeloresposta">
			
			<fieldset id="fieldsetConsulta">
			
			<table class=linhasAlternadas align="center">

					<tr>
						<th><fmt:message key="consulta.modulo.modelo.resposta.campo.descricao"></fmt:message></th>
					</tr>

					<tr>
						<td>${modeloresposta.descricao}</td>
					</tr>


			</table>
			
			<br />	

			<table class=linhasAlternadas align="center">

					<tr>
					  <c:forEach items="${modeloresposta.alternativas}" var="modeloalternativa">
						<th><fmt:message key="consulta.modulo.modelo.resposta.campo.alt.resposta"></fmt:message></th>
					  </c:forEach>
						<th><fmt:message key="consulta.modulo.modelo.resposta.alterar"></fmt:message></th>
						<th><fmt:message key="consulta.modulo.modelo.resposta.excluir"></fmt:message></th>
					
					</tr>
					<tr>
					  <c:forEach items="${modeloresposta.alternativas}" var="modeloalternativa">
						<td>${modeloalternativa.alt_resposta}</td>
					  </c:forEach>
						<td><a href="exibeModeloResposta?id_modelo_resposta=${modeloresposta.id_modelo_resposta}"><div class=imgAlterar></div></a></td>
						<td><a href="javascript:void(0)" onclick="chamaExcluirModeloResposta(${modeloresposta.id_modelo_resposta})"><div class=imgExcluir></div></a></td>
					
					</tr>
			</table>		
			<br />
			<br />
			<br />
			</fieldset>
			<br />
			<br />
			<br />
			</c:forEach>
			
		</fieldset>
		<table>
				<tr> 
					<td>  <div id="dialog-confirmaExclusao" title="Excluir" style="display: none;">
						<p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 1px 0;"></span><fmt:message key="pds.excluir"></fmt:message></p>
					</div>
					</td> 
				</tr> 
		</table>
		</div>
	</body>
</fmt:bundle>
</html>